<?php
/*
 * @Author: your name
 * @Date: 2021-09-21 16:46:35
 * @LastEditTime: 2022-02-10 15:56:33
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /nlog/app/Http/Controllers/AdminController/Login.php
 */

namespace App\Http\Controllers\admin_controller;

use Illuminate\Support\Facades\Request;
// use App\Models\admin_model\Housing as HousingDb;
use App\Models\admin_model\OperationLog as OperationLogDb;

class OperationLog extends BaseController
{






    public function operationLogList()
    {

        $whereStr = '';
        $limitStr = '';
        if (Request::input('pageSize') && Request::input('page')) {
            $limitStr =   limit_joint(Request::input('page'), Request::input('pageSize'));
        }
        if (Request::has('keyWord')) {
            $keyWord = array_filter(Request::input('keyWord'), 'filtrfunction');
            if (!empty($keyWord)) {
                if (isset($keyWord['manyField'])) {
                    $whereStr .= havaWhereLikeManyField($keyWord['manyField'],'-',false);
                    unset($keyWord['manyField']);
                }
                if (!empty($keyWord)) {
                    $whereStr .= havaWhereLikeJoinEqual($keyWord, $whereStr?true:false);
                }
                if ($whereStr) {
                    $whereStr = ' WHERE ' .$whereStr;
                }
            }
        }
        $list  =   OperationLogDb::list($whereStr, $limitStr);
        $count =   OperationLogDb::count($whereStr);
        return $this->create(200, '查询成功', ['list' => $list, 'total' => $count[0]['count']]);
    }
}
